package lab14;

import java.util.Scanner;
import java.io.*;

public class task4 {

	public static void main(String[] args) throws IOException{
		int i , j;
		int [] ID = new int [5];
		double [][] grades = new double[5][5];

		
		Scanner reader = new Scanner(new FileInputStream("grade.txt"));
		

		for(i = 0 ; i < 5 ; i++) {
			ID[i] = reader.nextInt();
			for(j = 0 ; j < 5 ; j++) {
			grades[i][j] = reader.nextDouble();			
			}
		}
		
		double [] avg = studentAverages(grades);

		System.out.println("#ID\tQuiz Average");
		for(i = 0 ; i < 5 ; i++) {
				System.out.printf("%d\t%12.1f\n",ID[i],avg[i]);
				}					
		
		reader.close();

	}


	private static double[] studentAverages(double[][] grades) {

		int i , j;
		double sum;
		double [] avg = {0 , 0 , 0 , 0 , 0};

		for(i = 0 ; i < 5 ; i++) {
			sum = 0;
			for(j = 0 ; j < 5 ; j++) {
			sum = sum + grades[i][j];
				}					
			avg[i] = sum/5.0;
			}
		return avg;
	}

}
